import { defineAsyncComponent } from 'vue';
import compConfig from './config.js';

const resultComps = {};

const requireComponent:any = import.meta.glob('./*.vue');

Object.keys(requireComponent).forEach((path) => {
	const comp = defineAsyncComponent(requireComponent[path]);
	const key = path.replace(/^\.\/(.*)\.\w+$/, '$1');

	resultComps[key] = {
		component: comp,
		info: compConfig[key]
	};
});

export default resultComps;
